
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>ORM · tgor note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="tgor">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../Java-其他库/分布式系统及CAP原理.html" />
    
    
    <link rel="prev" href="../Java-其他库/分布式定时作业.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Me
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../category/微服务.html">
            
                <a href="../category/微服务.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Java-Spring/Feign.html">
            
                <a href="../Java-Spring/Feign.html">
            
                    
                    HTTP客户端Feign
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Java-其他库/限流.html">
            
                <a href="../Java-其他库/限流.html">
            
                    
                    限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    限流Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../Java-Spring/负载均衡.html">
            
                <a href="../Java-Spring/负载均衡.html">
            
                    
                    负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    负载均衡Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../Java-其他库/熔断Hystrix.html">
            
                <a href="../Java-其他库/熔断Hystrix.html">
            
                    
                    熔断Hystrix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html">
            
                    
                    缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html#本地缓存">
            
                    
                    本地缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    分布式缓存Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html">
            
                    
                    分布式事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html#事务消息">
            
                    
                    可靠事务消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../Java-Spring/业务监控.html">
            
                <a href="../Java-Spring/业务监控.html">
            
                    
                    业务监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../Java-其他库/分布式定时作业.html">
            
                <a href="../Java-其他库/分布式定时作业.html">
            
                    
                    分布式作业调度ElasticJob
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.14" data-path="ORM.html">
            
                <a href="ORM.html">
            
                    
                    ORM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="../Java-其他库/分布式系统及CAP原理.html">
            
                <a href="../Java-其他库/分布式系统及CAP原理.html">
            
                    
                    分布式系统及CAP原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="../MQ/RabbitMQ笔记.html">
            
                <a href="../MQ/RabbitMQ笔记.html">
            
                    
                    消息驱动Rabbitmq
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../category/数据库.html">
            
                <a href="../category/数据库.html">
            
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Mysql/经典数据库设计案例.html">
            
                <a href="../Mysql/经典数据库设计案例.html">
            
                    
                    mysql设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Mysql/Mysql事务与锁.html">
            
                <a href="../Mysql/Mysql事务与锁.html">
            
                    
                    mysql事务与锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Mysql/mysql数据类型.html">
            
                <a href="../Mysql/mysql数据类型.html">
            
                    
                    mysql数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html">
            
                    
                    mysql索引与查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html#查询语句设计准则">
            
                    
                    mysql查询语句设计准则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Mysql/mysql性能测试.html">
            
                <a href="../Mysql/mysql性能测试.html">
            
                    
                    mysql性能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Mysql/mysql主从同步与读写分离.html">
            
                <a href="../Mysql/mysql主从同步与读写分离.html">
            
                    
                    mysql主从同步与读写分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                <a href="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                    
                    Spring事务注解@Transactional
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../数据结构与算法/位运算应用实例.html">
            
                <a href="../数据结构与算法/位运算应用实例.html">
            
                    
                    位运算应用实例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Mongodb-Client/morphia-API汇总.html">
            
                <a href="../Mongodb-Client/morphia-API汇总.html">
            
                    
                    morphia API汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Mongodb-Client/mongo驱动连接.html">
            
                <a href="../Mongodb-Client/mongo驱动连接.html">
            
                    
                    mongodb驱动与连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Mongodb/mongodb-ObjectId实践.html">
            
                <a href="../Mongodb/mongodb-ObjectId实践.html">
            
                    
                    mongodb ObjectId实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Mongodb/mongodb角色权限.html">
            
                <a href="../Mongodb/mongodb角色权限.html">
            
                    
                    mongodb角色权限
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../category/java并发.html">
            
                <a href="../category/java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#锁">
            
                    
                    Java并发之锁设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#synchronized">
            
                    
                    Java并发之synchronized
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantlock">
            
                    
                    Java Lock之ReentrantLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantreadwritelock">
            
                    
                    Java Lock之ReentrantReadWriteLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html">
            
                    
                    Java Future
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#futuretask">
            
                    
                    Java Future之FutureTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#completablefuture">
            
                    
                    Java Future之CompletableFuture
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#forkjointask">
            
                    
                    Java Future之ForkJoinTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Java-Base/Java之Thread.html">
            
                <a href="../Java-Base/Java之Thread.html">
            
                    
                    Java Thread
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../category/redis.html">
            
                <a href="../category/redis.html">
            
                    
                    Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#集群">
            
                    
                    Redis集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#消息订阅">
            
                    
                    Redis消息订阅
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#lua">
            
                    
                    Redis Lua脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#配置汇总">
            
                    
                    Redis配置汇总
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../category/运维.html">
            
                <a href="../category/运维.html">
            
                    
                    运维
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../运维/Linux常用操作汇总.html">
            
                <a href="../运维/Linux常用操作汇总.html">
            
                    
                    Linux常用操作汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../运维/阿里云笔记.html">
            
                <a href="../运维/阿里云笔记.html">
            
                    
                    阿里云笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../category/nginx.html">
            
                <a href="../category/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html">
            
                    
                    Nginx基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    Nginx负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    Nginx限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html#六、其他">
            
                    
                    Nginx客户端辅助技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../category/容器化.html">
            
                <a href="../category/容器化.html">
            
                    
                    容器化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html">
            
                    
                    Docker学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#基础操作">
            
                    
                    Docker基础操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#dockerfile">
            
                    
                    DockerFile
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../category/Web.html">
            
                <a href="../category/Web.html">
            
                    
                    Web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../运维/Http入坑Https笔记.html">
            
                <a href="../运维/Http入坑Https笔记.html">
            
                    
                    Http入坑Https笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Web/阿里云OSS.html">
            
                <a href="../Web/阿里云OSS.html">
            
                    
                    OSS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../category/java基础.html">
            
                <a href="../category/java基础.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#jvm">
            
                    
                    JVM基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#语法糖">
            
                    
                    Java语法糖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#数据结构">
            
                    
                    Java数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../Java-Base/Java8函数式编程.html">
            
                <a href="../Java-Base/Java8函数式编程.html">
            
                    
                    java8函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../Java-Base/ArrayList源码分析.html">
            
                <a href="../Java-Base/ArrayList源码分析.html">
            
                    
                    JDK源码分析ArrayList
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../Java-Base/HashMap源码分析.html">
            
                <a href="../Java-Base/HashMap源码分析.html">
            
                    
                    JDK源码分析HashMap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../Java-Base/Java注解.html">
            
                <a href="../Java-Base/Java注解.html">
            
                    
                    Java注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../Java-Base/Timsort排序算法.html">
            
                <a href="../Java-Base/Timsort排序算法.html">
            
                    
                    Timsort排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../Java-Base/插入排序分析与Java实现.html">
            
                <a href="../Java-Base/插入排序分析与Java实现.html">
            
                    
                    插入排序分析与Java实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../category/工具与规范.html">
            
                <a href="../category/工具与规范.html">
            
                    
                    工具与规范
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../工具/Maven使用技巧汇总.html">
            
                <a href="../工具/Maven使用技巧汇总.html">
            
                    
                    Maven使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../编码规范/Java编码规范.html">
            
                <a href="../编码规范/Java编码规范.html">
            
                    
                    Java编码规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../category/OLAP.html">
            
                <a href="../category/OLAP.html">
            
                    
                    OLAP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../数据处理/storm学习笔记.html">
            
                <a href="../数据处理/storm学习笔记.html">
            
                    
                    流式计算Storm学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../category/数据运营.html">
            
                <a href="../category/数据运营.html">
            
                    
                    数据运营
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../数据运营/增长黑客数据运营.html">
            
                <a href="../数据运营/增长黑客数据运营.html">
            
                    
                    增长黑客-数据运营
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../category/前端技术栈.html">
            
                <a href="../category/前端技术栈.html">
            
                    
                    前端技术栈
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../前端/JavaScript设计模式.html">
            
                <a href="../前端/JavaScript设计模式.html">
            
                    
                    JavaScript设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../前端/html相对路径与绝对路径.html">
            
                <a href="../前端/html相对路径与绝对路径.html">
            
                    
                    Html相对路径与绝对路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../前端/微信小程序学习笔记.html">
            
                <a href="../前端/微信小程序学习笔记.html">
            
                    
                    微信小程序学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../category/个人.html">
            
                <a href="../category/个人.html">
            
                    
                    个人
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../个人/简历.html">
            
                <a href="../个人/简历.html">
            
                    
                    简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >ORM</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="orm">ORM</h1>
<h1 id="mybatis&#x914D;&#x7F6E;&#x6280;&#x5DE7;">MyBatis&#x914D;&#x7F6E;&#x6280;&#x5DE7;</h1>
<h2 id="&#x63D0;&#x7EB2;&#x4E0E;&#x5B66;&#x4E60;&#x8DEF;&#x7EBF;">&#x63D0;&#x7EB2;&#x4E0E;&#x5B66;&#x4E60;&#x8DEF;&#x7EBF;</h2>
<ol>
<li>mybatis&#x642D;&#x5EFA;&#x7B80;&#x5355;&#x5165;&#x95E8;&#xFF1A;<a href="http://www.cnblogs.com/xdp-gacl/p/4261895.html" target="_blank">http://www.cnblogs.com/xdp-gacl/p/4261895.html</a></li>
<li>&#x57FA;&#x7840;crud&#xFF1A;<a href="http://www.cnblogs.com/xdp-gacl/p/4262895.html" target="_blank">http://www.cnblogs.com/xdp-gacl/p/4262895.html</a></li>
<li>resultMap&#x5D4C;&#x5957;&#x5BF9;&#x8C61;&#xFF1A;<a href="http://www.cnblogs.com/hamhog/p/3959451.html" target="_blank">http://www.cnblogs.com/hamhog/p/3959451.html</a></li>
<li>resultMap&#x4E0E;parameterMap&#x76F8;&#x540C;&#xFF0C;&#x5982;&#x4F55;&#x907F;&#x514D;&#x91CD;&#x590D;&#x7F16;&#x5199;&#xFF1B;&#x7B54;&#xFF1A;&#x53C2;&#x6570;&#x76F4;&#x63A5;&#x4F7F;&#x7528;parameterType&#x6307;&#x5411;Class&#xFF0C;&#x7ED1;&#x5B9A;&#x5B57;&#x6BB5;</li>
<li>&#x5982;&#x4F55;&#x8C03;&#x7528;&#x5B58;&#x50A8;&#x8FC7;&#x7A0B;&#xFF1A;<a href="http://blog.csdn.net/u012948731/article/details/49003361" target="_blank">http://blog.csdn.net/u012948731/article/details/49003361</a></li>
<li>mysql&#x67E5;&#x8BE2;&#x5206;&#x9875;&#xFF1A;<a href="http://blog.csdn.net/ls_man/article/details/11783813" target="_blank">http://blog.csdn.net/ls_man/article/details/11783813</a></li>
<li>parameterType&#x7C7B;&#x578B;&#x4E3A;List&#x7684;&#x914D;&#x7F6E;&#x65B9;&#x6CD5;&#xFF1A;<a href="http://blog.csdn.net/lsq_401/article/details/46776223" target="_blank">http://blog.csdn.net/lsq_401/article/details/46776223</a></li>
</ol>
<hr>
<h2 id="conf&#x914D;&#x7F6E;">Conf&#x914D;&#x7F6E;</h2>
<p>&#x901A;&#x8FC7;Maven&#x6253;&#x5305;&#x65F6;&#xFF0C;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x4E0D;&#x4F1A;&#x6253;&#x5305;src&#x76EE;&#x5F55;&#x4E0B;&#x7684;xml&#x6587;&#x4EF6;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x5982;&#x4E0B;&#x7ED3;&#x6784;&#x4F1A;&#x62A5;&#x9519;<code>Could not find resource com.tg.mybatis.lotteryMapper.xml</code></p>
<p><img src="http://static.zybuluo.com/zero1036/p5k4o3ajwwp31qvrc97aknqw/image_1bksotdah1dh1164213356qr1idpg.png" alt="image_1bksotdah1dh1164213356qr1idpg.png-5.6kB"></p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">configuration</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">environments</span> <span class="hljs-attr">default</span>=<span class="hljs-string">&quot;development&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">environment</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;development&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">transactionManager</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;JDBC&quot;</span>/&gt;</span>
            <span class="hljs-comment">&lt;!-- &#x914D;&#x7F6E;&#x6570;&#x636E;&#x5E93;&#x8FDE;&#x63A5;&#x4FE1;&#x606F; --&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">dataSource</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;POOLED&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;driver&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;com.mysql.jdbc.Driver&quot;</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;url&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;xxx&quot;</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;username&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;u&quot;</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;password&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;pwd&quot;</span>/&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">dataSource</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">environment</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">environments</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">mappers</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">mapper</span> <span class="hljs-attr">resource</span>=<span class="hljs-string">&quot;com/tg/mybatis/lotteryMapper.xml&quot;</span>/&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">mappers</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">configuration</span>&gt;</span>
</code></pre>
<p>Maven Mapper.xml&#x5EFA;&#x8BAE;&#x6DFB;&#x52A0;&#x5230;resources&#x76EE;&#x5F55;&#x4E2D;&#xFF0C;<code>&lt;mappers/&gt;</code>&#x8C03;&#x6574;&#xFF1A;</p>
<pre><code class="lang-xml">    <span class="hljs-tag">&lt;<span class="hljs-name">mappers</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">mapper</span> <span class="hljs-attr">resource</span>=<span class="hljs-string">&quot;mapper/lotteryMapper.xml&quot;</span>/&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">mappers</span>&gt;</span>
</code></pre>
<hr>
<h2 id="mapper&#x914D;&#x7F6E;">Mapper&#x914D;&#x7F6E;</h2>
<h3 id="parametertype">parameterType</h3>
<p><a href="http://blog.csdn.net/kingjin_csdn_/article/details/53156732" target="_blank">http://blog.csdn.net/kingjin_csdn_/article/details/53156732</a></p>
<ol>
<li><p>MyBatis&#x7684;&#x4F20;&#x5165;&#x53C2;&#x6570;parameterType&#x7C7B;&#x578B;&#x5206;&#x4E24;&#x79CD;</p>
<ol>
<li><ol>
<li>&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF1A;int,string,long,Date;</li>
</ol>
</li>
<li><ol>
<li>&#x590D;&#x6742;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF1A;&#x7C7B;&#x548C;Map
&#x6CE8;&#xFF1A;&#x4E0D;&#x540C;&#x7248;&#x672C;&#x7684;MyBatis&#x5BF9;&#x57FA;&#x672C;&#x7C7B;&#x578B;&#x4F20;&#x9012;&#x8FC7;&#x6765;&#x7684;&#x53C2;&#x6570;&#x540D;&#x79F0;&#x4E0D;&#x80FD;&#x8BC6;&#x522B;&#xFF0C;&#x8981;&#x4F7F;&#x7528;_parameter&#x6765;&#x4EE3;&#x66FF;&#x3002;
[html] view plain copy print?<select id="getWinLogByEventId" parametertype="java.lang.Long" resultmap="BaseResultMap">  
select <include refid="Base_Column_List"> from win_log where eventId = #{_parameter,jdbcType=BIGINT}  
</include></select>  
</li>
</ol>
</li>
</ol>
</li>
<li><p>&#x5982;&#x4F55;&#x83B7;&#x53D6;&#x53C2;&#x6570;&#x4E2D;&#x7684;&#x503C;:
2.1  &#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF1A;#{&#x53C2;&#x6570;} &#x83B7;&#x53D6;&#x53C2;&#x6570;&#x4E2D;&#x7684;&#x503C;
2.2  &#x590D;&#x6742;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF1A;#{&#x5C5E;&#x6027;&#x540D;}  &#xFF0C;map&#x4E2D;&#x5219;&#x662F;#{key}</p>
</li>
</ol>
<hr>
<h3 id="resulttype">resultType</h3>
<hr>
<h3 id="&#x3010;foreach&#x3011;&#x6807;&#x7B7E;">&#x3010;foreach&#x3011;&#x6807;&#x7B7E;</h3>
<p>xml&#x8BED;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">foreach</span> <span class="hljs-attr">collection</span>=<span class="hljs-string">&quot;list&quot;</span> <span class="hljs-attr">item</span>=<span class="hljs-string">&quot;item&quot;</span> <span class="hljs-attr">open</span>=<span class="hljs-string">&quot;(&quot;</span> <span class="hljs-attr">close</span>=<span class="hljs-string">&quot;)&quot;</span> <span class="hljs-attr">separator</span>=<span class="hljs-string">&quot;,&quot;</span> <span class="hljs-attr">index</span>=<span class="hljs-string">&quot;index&quot;</span>&gt;</span>
   #{item.xx}, #{item.xx}
<span class="hljs-tag">&lt;/<span class="hljs-name">foreach</span>&gt;</span>
</code></pre>
<table>
<thead>
<tr>
<th>&#x9879;&#x76EE;</th>
<th style="text-align:right">&#x4EF7;&#x683C;</th>
</tr>
</thead>
<tbody>
<tr>
<td>collection=&quot;list&quot;</td>
<td style="text-align:right">&#x5176;&#x4E2D;list&#x662F;&#x56FA;&#x5B9A;&#x7684;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x6570;&#x7EC4;&#x5C31;&#x662F;array</td>
</tr>
<tr>
<td>item=&quot;item&quot;</td>
<td style="text-align:right">&#x5FAA;&#x73AF;&#x4E2D;&#x6BCF;&#x4E00;&#x9879;&#x7684;&#x522B;&#x540D;</td>
</tr>
<tr>
<td>open=&quot;&quot;</td>
<td style="text-align:right">&#x5F00;&#x59CB;&#x6807;&#x8BC6;&#xFF0C;&#x6BD4;&#x5982;&#x5220;&#x9664;in (id1,id2)&#xFF0C; open=&quot;(&quot; close=&quot;)&quot;</td>
</tr>
<tr>
<td>close=&quot;&quot;</td>
<td style="text-align:right">&#x7ED3;&#x675F;&#x6807;&#x8BC6;</td>
</tr>
<tr>
<td>separator=&quot;,&quot;</td>
<td style="text-align:right">&#x5206;&#x9694;&#x7B26;&#x53F7;</td>
</tr>
<tr>
<td>index=&quot;index&quot;</td>
<td style="text-align:right">&#x4E0B;&#x6807;&#x503C;</td>
</tr>
</tbody>
</table>
<h4 id="&#x5355;&#x53C2;&#x6570;list&#x7684;&#x7C7B;&#x578B;&#xFF1A;">&gt; &#x5355;&#x53C2;&#x6570;List&#x7684;&#x7C7B;&#x578B;&#xFF1A;</h4>
<p>code:<code>List ids = new ArrayList();List blogs = blogMapper.dynamicForeachTest(ids);</code></p>
<pre><code class="lang-xml"> <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;dynamicForeachTest&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;java.util.List&quot;</span> <span class="hljs-attr">resultType</span>=<span class="hljs-string">&quot;Blog&quot;</span>&gt;</span>
           select * from t_blog where id in
        <span class="hljs-tag">&lt;<span class="hljs-name">foreach</span> <span class="hljs-attr">collection</span>=<span class="hljs-string">&quot;list&quot;</span> <span class="hljs-attr">index</span>=<span class="hljs-string">&quot;index&quot;</span> <span class="hljs-attr">item</span>=<span class="hljs-string">&quot;item&quot;</span> <span class="hljs-attr">open</span>=<span class="hljs-string">&quot;(&quot;</span> <span class="hljs-attr">separator</span>=<span class="hljs-string">&quot;,&quot;</span> <span class="hljs-attr">close</span>=<span class="hljs-string">&quot;)&quot;</span>&gt;</span>
                #{item}       
        <span class="hljs-tag">&lt;/<span class="hljs-name">foreach</span>&gt;</span>    
    <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>
</code></pre>
<h4 id="&#x81EA;&#x5DF1;&#x628A;&#x53C2;&#x6570;&#x5C01;&#x88C5;&#x6210;map&#x7684;&#x7C7B;&#x578B;">&gt; &#x81EA;&#x5DF1;&#x628A;&#x53C2;&#x6570;&#x5C01;&#x88C5;&#x6210;Map&#x7684;&#x7C7B;&#x578B;</h4>
<p>&#x6CE8;&#x610F;&#xFF1A;&#x4E0A;&#x8FF0;collection&#x7684;&#x503C;&#x4E3A;ids&#xFF0C;&#x662F;&#x4F20;&#x5165;&#x7684;&#x53C2;&#x6570;Map&#x7684;key&#xFF0C;&#x5BF9;&#x5E94;&#x7684;Mapper&#x4EE3;&#x7801;&#xFF1A; 
public List dynamicForeach3Test(Map params); </p>
<p>code:</p>
<pre><code class="lang-java">List ids = <span class="hljs-keyword">new</span> ArrayList();List blogs = blogMapper.dynamicForeachTest(ids);
  <span class="hljs-keyword">final</span> List ids = <span class="hljs-keyword">new</span> ArrayList();
          ids.add(<span class="hljs-number">1</span>);
          ids.add(<span class="hljs-number">2</span>);
          ids.add(<span class="hljs-number">3</span>);
          ids.add(<span class="hljs-number">6</span>);
         ids.add(<span class="hljs-number">7</span>);
         ids.add(<span class="hljs-number">9</span>);
        Map params = <span class="hljs-keyword">new</span> HashMap();
         params.put(<span class="hljs-string">&quot;ids&quot;</span>, ids);
         params.put(<span class="hljs-string">&quot;title&quot;</span>, <span class="hljs-string">&quot;&#x4E2D;&#x56FD;&quot;</span>);
        List blogs = blogMapper.dynamicForeach3Test(params);
</code></pre>
<pre><code class="lang-xml"> <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;dynamicForeach3Test&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;java.util.HashMap&quot;</span> <span class="hljs-attr">resultType</span>=<span class="hljs-string">&quot;Blog&quot;</span>&gt;</span>
         select * from t_blog where title like &quot;%&quot;#{title}&quot;%&quot; and id in
          <span class="hljs-tag">&lt;<span class="hljs-name">foreach</span> <span class="hljs-attr">collection</span>=<span class="hljs-string">&quot;ids&quot;</span> <span class="hljs-attr">index</span>=<span class="hljs-string">&quot;index&quot;</span> <span class="hljs-attr">item</span>=<span class="hljs-string">&quot;item&quot;</span> <span class="hljs-attr">open</span>=<span class="hljs-string">&quot;(&quot;</span> <span class="hljs-attr">separator</span>=<span class="hljs-string">&quot;,&quot;</span> <span class="hljs-attr">close</span>=<span class="hljs-string">&quot;)&quot;</span>&gt;</span>
               #{item}
          <span class="hljs-tag">&lt;/<span class="hljs-name">foreach</span>&gt;</span>
 <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>
</code></pre>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;findListByNos&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;list&quot;</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">&quot;BaseResultMap&quot;</span>&gt;</span>  
        SELECT   
         <span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;Base_Column_List&quot;</span>/&gt;</span>  
         FROM INFO  
            WHERE INFO_ID IN  
            <span class="hljs-tag">&lt;<span class="hljs-name">foreach</span> <span class="hljs-attr">collection</span>=<span class="hljs-string">&quot;list&quot;</span> <span class="hljs-attr">index</span>=<span class="hljs-string">&quot;index&quot;</span> <span class="hljs-attr">item</span>=<span class="hljs-string">&quot;item&quot;</span> <span class="hljs-attr">open</span>=<span class="hljs-string">&quot;(&quot;</span> <span class="hljs-attr">close</span>=<span class="hljs-string">&quot;)&quot;</span> <span class="hljs-attr">separator</span>=<span class="hljs-string">&quot;,&quot;</span>&gt;</span>  
                    #{item}  
         <span class="hljs-tag">&lt;/<span class="hljs-name">foreach</span>&gt;</span>  
            ORDER BY INFO_ID DESC  
    <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>  

  <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;findById&quot;</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">&quot;BaseResultMap&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;java.lang.String&quot;</span> &gt;</span>  
    SELECT   
    <span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;Base_Column_List&quot;</span> /&gt;</span>  
     FROM INFO  
     WHERE INFO_ID = #{infoId,jdbcType=VARCHAR}  
  <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>  

<span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;findByEntityWithPagination&quot;</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">&quot;BaseResultMap&quot;</span> &gt;</span>  
 SELECT  
    <span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;Base_Column_List&quot;</span> /&gt;</span>  
    FROM INFO  
    <span class="hljs-tag">&lt;<span class="hljs-name">trim</span> <span class="hljs-attr">prefix</span>=<span class="hljs-string">&quot;WHERE&quot;</span> <span class="hljs-attr">suffixOverrides</span>=<span class="hljs-string">&quot;AND&quot;</span> &gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;param1.infoType != null&quot;</span> &gt;</span>  
        INFO_TYPE = #{param1.infoType,jdbcType=VARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;param1.infoContent != null&quot;</span> &gt;</span>  
        INFO_CONTENT = #{param1.infoContent,jdbcType=LONGVARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>    
    <span class="hljs-tag">&lt;/<span class="hljs-name">trim</span>&gt;</span>  
     LIMIT #{param2} , #{param3}  
  <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>  

<span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;findByProperties&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;map&quot;</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">&quot;BaseResultMap&quot;</span> &gt;</span>  
    SELECT   
    <span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;Base_Column_List&quot;</span> /&gt;</span>  
    FROM INFO  
    <span class="hljs-tag">&lt;<span class="hljs-name">trim</span> <span class="hljs-attr">prefix</span>=<span class="hljs-string">&quot;WHERE&quot;</span> <span class="hljs-attr">suffixOverrides</span>=<span class="hljs-string">&quot;AND&quot;</span> &gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;_parameter.containsKey(&apos;infoType&apos;)&quot;</span> &gt;</span>  
        INFO_TYPE = #{infoType,jdbcType=VARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;_parameter.containsKey(&apos;infoContent&apos;)&quot;</span> &gt;</span>  
        INFO_CONTENT = #{infoContent,jdbcType=LONGVARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;_parameter.containsKey(&apos;infoName&apos;)&quot;</span> &gt;</span>  
        INFO_NAME = #{infoName,jdbcType=VARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
    <span class="hljs-tag">&lt;/<span class="hljs-name">trim</span>&gt;</span>  
    ORDER BY INFO_ID  
  <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>  

   <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;findByEntity&quot;</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">&quot;BaseResultMap&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;com.cn.Info&quot;</span> &gt;</span>  
    SELECT  
    <span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;Base_Column_List&quot;</span> /&gt;</span>  
    FROM INFO  
    <span class="hljs-tag">&lt;<span class="hljs-name">trim</span> <span class="hljs-attr">prefix</span>=<span class="hljs-string">&quot;WHERE&quot;</span> <span class="hljs-attr">suffixOverrides</span>=<span class="hljs-string">&quot;AND&quot;</span> &gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;infoType != null&quot;</span> &gt;</span>  
        INFO_TYPE = #{infoType,jdbcType=VARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
      <span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;infoContent != null&quot;</span> &gt;</span>  
        INFO_CONTENT = #{infoContent,jdbcType=LONGVARCHAR} AND  
      <span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>  
    <span class="hljs-tag">&lt;/<span class="hljs-name">trim</span>&gt;</span>  
  <span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span>
</code></pre>
<h4 id="&#x6279;&#x91CF;&#x63D2;&#x5165;">&#x6279;&#x91CF;&#x63D2;&#x5165;</h4>
<pre><code class="lang-xml">//java code
int id = mapper.batchSave(List<span class="hljs-tag">&lt;<span class="hljs-name">User</span>&gt;</span> list)


<span class="hljs-comment">&lt;!-- &#x6279;&#x91CF;&#x4FDD;&#x5B58;&#x7528;&#x6237;,&#x5E76;&#x8FD4;&#x56DE;&#x6BCF;&#x4E2A;&#x7528;&#x6237;&#x63D2;&#x5165;&#x7684;ID --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">insert</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;batchSave&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;java.util.List&quot;</span> <span class="hljs-attr">useGeneratedKeys</span>=<span class="hljs-string">&quot;true&quot;</span> <span class="hljs-attr">keyProperty</span>=<span class="hljs-string">&quot;id&quot;</span>&gt;</span>
    INSERT INTO `test`.`tb_user`(`username`, age)
    VALUES
    <span class="hljs-tag">&lt;<span class="hljs-name">foreach</span> <span class="hljs-attr">collection</span>=<span class="hljs-string">&quot;list&quot;</span> <span class="hljs-attr">item</span>=<span class="hljs-string">&quot;item&quot;</span> <span class="hljs-attr">separator</span>=<span class="hljs-string">&quot;,&quot;</span>&gt;</span>
        (#{item.username}, #{item.age})
    <span class="hljs-tag">&lt;/<span class="hljs-name">foreach</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">insert</span>&gt;</span>
</code></pre>
<hr>
<h3 id="&#x3010;insert&#x3011;">&#x3010;insert&#x3011;</h3>
<h4 id="insert&#x63D2;&#x5165;&#x8FD4;&#x56DE;&#x4E3B;&#x952E;id">insert&#x63D2;&#x5165;&#x8FD4;&#x56DE;&#x4E3B;&#x952E;ID</h4>
<p>&#x5F88;&#x591A;&#x65F6;&#x5019;&#xFF0C;&#x5728;&#x5411;&#x6570;&#x636E;&#x5E93;&#x63D2;&#x5165;&#x6570;&#x636E;&#x65F6;&#xFF0C;&#x9700;&#x8981;&#x4FDD;&#x7559;&#x63D2;&#x5165;&#x6570;&#x636E;&#x7684;id&#xFF0C;&#x4EE5;&#x4FBF;&#x8FDB;&#x884C;&#x540E;&#x7EED;&#x7684;update&#x64CD;&#x4F5C;&#x6216;&#x8005;&#x5C06;id&#x5B58;&#x5165;&#x5176;&#x4ED6;&#x8868;&#x4F5C;&#x4E3A;&#x5916;&#x952E;&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x5728;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;insert&#x64CD;&#x4F5C;&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E00;&#x4E2A;int&#x503C;&#xFF0C;&#x5E76;&#x4E14;&#x4E0D;&#x662F;&#x8868;&#x793A;&#x4E3B;&#x952E;id&#xFF0C;&#x800C;&#x662F;&#x8868;&#x793A;&#x5F53;&#x524D;SQL&#x8BED;&#x53E5;&#x5F71;&#x54CD;&#x7684;&#x884C;&#x6570;&#x3002;&#x3002;&#x3002;</p>
<p>MyBatis&#x5728;&#x4F7F;&#x7528;MySQL insert&#x63D2;&#x5165;&#x64CD;&#x4F5C;&#x65F6;&#x5C06;&#x8FD4;&#x56DE;&#x7684;id&#x7ED1;&#x5B9A;&#x5230;&#x5BF9;&#x8C61;&#x4E2D;&#x3002;</p>
<p>MySQL&#x7528;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">insert</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;insert&quot;</span> <span class="hljs-attr">parameterType</span>=<span class="hljs-string">&quot;com.test.User&quot;</span>  <span class="hljs-attr">keyProperty</span>=<span class="hljs-string">&quot;userId&quot;</span> <span class="hljs-attr">useGeneratedKeys</span>=<span class="hljs-string">&quot;true&quot;</span> &gt;</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x914D;&#x7F6E;&#x4E2D;&#xFF0C;&#x201C;keyProperty&#x201D;&#x8868;&#x793A;&#x8FD4;&#x56DE;&#x7684;id&#x8981;&#x4FDD;&#x5B58;&#x5230;&#x5BF9;&#x8C61;&#x7684;&#x90A3;&#x4E2A;&#x5C5E;&#x6027;&#x4E2D;&#xFF0C;&#x201C;useGeneratedKeys&#x201D;&#x8868;&#x793A;&#x4E3B;&#x952E;id&#x4E3A;&#x81EA;&#x589E;&#x957F;&#x6A21;&#x5F0F;&#x3002;</p>
<hr>
<h3 id="&#x3010;if&#x3011;&#x6807;&#x7B7E;">&#x3010;if&#x3011;&#x6807;&#x7B7E;</h3>
<pre><code>    &lt;if test=&quot;_parameter != null and _parameter &gt; 0&quot;&gt;
        AND id = #{_parameter}
    &lt;/if&gt;

    &#x8FDE;&#x63A5;&#x7B26;and&#x5FC5;&#x987B;&#x5C0F;&#x5199;&#xFF0C;&#x5426;&#x5219;&#x62A5;&#x9519;&#xFF0C;&#x9650;&#x5B9A;&#x4EE5;&#x4E0B;

        &lt;EOF&gt; 
&quot;,&quot; ...
&quot;=&quot; ...
&quot;?&quot; ...
&quot;||&quot; ...
&quot;or&quot; ...
&quot;&amp;&amp;&quot; ...
&quot;and&quot; ...
&quot;|&quot; ...
&quot;bor&quot; ...
&quot;^&quot; ...
&quot;xor&quot; ...
&quot;&amp;&quot; ...
&quot;band&quot; ...
&quot;==&quot; ...
&quot;eq&quot; ...
&quot;!=&quot; ...
&quot;neq&quot; ...
&quot;&lt;&quot; ...
&quot;lt&quot; ...
&quot;&gt;&quot; ...
&quot;gt&quot; ...
&quot;&lt;=&quot; ...
&quot;lte&quot; ...
&quot;&gt;=&quot; ...
&quot;gte&quot; ...
&quot;in&quot; ...
&quot;not&quot; ...
&quot;&lt;&lt;&quot; ...
&quot;shl&quot; ...
&quot;&gt;&gt;&quot; ...
&quot;shr&quot; ...
&quot;&gt;&gt;&gt;&quot; ...
&quot;ushr&quot; ...
&quot;+&quot; ...
&quot;-&quot; ...
&quot;*&quot; ...
&quot;/&quot; ...
&quot;%&quot; ...
&quot;instanceof&quot; ...
&quot;.&quot; ...
&quot;(&quot; ...
&quot;[&quot; ...
&lt;DYNAMIC_SUBSCRIPT&gt; ...
</code></pre><hr>
<h2 id="&#x8BFB;&#x5199;&#x5206;&#x79BB;">&#x8BFB;&#x5199;&#x5206;&#x79BB;</h2>
<p><a href="../Mysql/mysql&#x4E3B;&#x4ECE;&#x540C;&#x6B65;&#x4E0E;&#x8BFB;&#x5199;&#x5206;&#x79BB;.html">mysql&#x4E3B;&#x4ECE;&#x540C;&#x6B65;&#x4E0E;&#x8BFB;&#x5199;&#x5206;&#x79BB;</a></p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; tgor.top 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-04-29 16:20:45
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../Java-其他库/分布式定时作业.html" class="navigation navigation-prev " aria-label="Previous page: 分布式作业调度ElasticJob">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../Java-其他库/分布式系统及CAP原理.html" class="navigation navigation-next " aria-label="Next page: 分布式系统及CAP原理">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"ORM","level":"1.2.14","depth":2,"next":{"title":"分布式系统及CAP原理","level":"1.2.15","depth":2,"path":"Java-其他库/分布式系统及CAP原理.md","ref":"Java-其他库/分布式系统及CAP原理.md","articles":[]},"previous":{"title":"分布式作业调度ElasticJob","level":"1.2.13","depth":2,"path":"Java-其他库/分布式定时作业.md","ref":"Java-其他库/分布式定时作业.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","splitter","tbfed-pagefooter","page-toc-button","-search","search-pro","popup","back-to-top-button","code","copy-code-button"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy tgor.top 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"sepia","family":"serif","size":1},"highlight":{},"page-toc-button":{"maxTocDepth":2,"minTocSize":2},"back-to-top-button":{},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"tgor","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"tgor note","gitbook":"*","description":"tgor生活工作记录"},"file":{"path":"Java-ORM/ORM.md","mtime":"2020-04-29T08:20:45.895Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-29T08:43:24.127Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

